class Scence1 extends Scence{
	public constructor() {
		super();
	}
	public async OnAdd() {
		this.init();
	}
	//初始化场景
	private f=true;
	private jx;
	private bgmusic;
	private bgmusic1;
	private bgmusic2;
	private bgmusic3;
	private a=true;
	private a1=true;
	private xian;
	public init() {
		let ks:egret.TextField=new egret.TextField();
		ks.text='开始游戏';
		ks.width=this.stage.stageWidth;
		ks.height=200;
		this.addChild(ks);
		ks.size=50;
		ks.textAlign = "center";
		ks.y=1000;
		ks.touchEnabled=true;
		ks.addEventListener(egret.TouchEvent.TOUCH_TAP,this.dj,this);
		let sz:egret.TextField=new egret.TextField();
		sz.text='设置';
		sz.width=100;
		sz.height=90;
		sz.y=20;
		sz.x=520;
		sz.textAlign = "center";
		this.addChild(sz);
		sz.touchEnabled=true;
		sz.addEventListener(egret.TouchEvent.TOUCH_TAP,this.szdj,this);
	}
	public dj(){
		let s2:Scence2=new Scence2();
		Guanli_Scence.get().changeScene(s2);
	}
	public szdj(){
		if(this.f){
		let jx:egret.Shape=new egret.Shape();
		jx.graphics.beginFill(0x000000,0.4);
		jx.graphics.drawRect(this.stage.stageWidth/2,this.stage.stageHeight/2,600,600);
		this.addChild(jx);
		jx.anchorOffsetX=jx.width/2;
		jx.anchorOffsetY=jx.height/2;
		this.jx=jx;
		this.f=false;

		let bgmusic:egret.TextField=new egret.TextField();
		bgmusic.text="背景音乐是否关闭:"
		bgmusic.size=30;
		this.addChild(bgmusic);
		bgmusic.x=100;
		bgmusic.y=300;
		this.bgmusic=bgmusic;

		let bgmusic2:egret.TextField=new egret.TextField();
		bgmusic2.text="是"
		bgmusic2.size=30;
		this.addChild(bgmusic2);
		bgmusic2.x=360;
		bgmusic2.y=300;
		this.bgmusic2=bgmusic2;
		bgmusic2.touchEnabled=true;
		bgmusic2.addEventListener(egret.TouchEvent.TOUCH_TAP,this.kg,this)

		let bgmusic1:egret.TextField=new egret.TextField();
		bgmusic1.text="音效是否关闭:"
		bgmusic1.size=30;
		this.addChild(bgmusic1);
		bgmusic1.x=100;
		bgmusic1.y=400;
		this.bgmusic1=bgmusic1;

		let bgmusic3:egret.TextField=new egret.TextField();
		bgmusic3.text="是"
		bgmusic3.size=30;
		this.addChild(bgmusic3);
		bgmusic3.x=300;
		bgmusic3.y=400;
		this.bgmusic3=bgmusic3;
		bgmusic3.touchEnabled=true;
		bgmusic3.addEventListener(egret.TouchEvent.TOUCH_TAP,this.kg1,this);

		let xian:egret.Shape=new egret.Shape();
		xian.graphics.beginFill(0xff0000,1);
		xian.graphics.lineStyle(5,0xff0000);
		xian.graphics.moveTo(50,600);
		xian.graphics.lineTo(590,600);
		xian.graphics.endFill();
		this.addChild(xian);
		this.xian=xian;

		}else{
			this.removeChild(this.jx);
			this.removeChild(this.bgmusic);
			this.removeChild(this.bgmusic1);
			this.removeChild(this.bgmusic2);
			this.removeChild(this.bgmusic3);
			this.removeChild(this.xian);
			this.f=true;
		}	
	}
	private kg(){
		if(this.a==true){
			this.bgmusic2.text="否"
			this.a=false;
		}
		else{
			this.bgmusic2.text="是"
			this.a=true;
		}
	}
	private kg1(){
		if(this.a1==true){
			this.bgmusic3.text="否"
			this.a1=false;
		}
		else{
			this.bgmusic3.text="是"
			this.a1=true;
		}
	}
	public OnRem() {
	}
}
